import tensorflow as tf

# constrct graph
# example of linear function y = W * x + b
W = tf.Variable(2.0, dtype=tf.float32, name="Weight") # Weight
b = tf.Variable(1.0, dtype=tf.float32, name="Bias") #Bias
x = tf.placeholder(dtype=tf.float32, name="Input") #Input
with tf.name_scope("Output"): #name sapce of output
    y = W * x + b #output

# define saved path
path = "./log"

# create an operation to init all vars
init = tf.initializers.global_variables()

#create session
with tf.Session() as sess:
    sess.run(init)
    write = tf.summary.FileWriter(path, sess.graph)
    result = sess.run(y, {x: 3.0})
    print("y = %s" % result)
